// pages/details/details.js
const app=getApp()
// const { rejects } = require('assert/strict');
// const { rejects } = require('assert');
// const { resolve } = require('path');
var WxParse = require('../../utils/wxParse/wxParse.js');
Page({
  data:{
  
  },


  onLoad:function(options){

    let that = this;
    wx.request({
      url: app.globalData.headurl+'getRecommendByID'+'/'+options.id, 
      method: 'GET',
      header: {
              'content-type': 'application/json'
            },
      success: function(res){
        console.log("文章数据：",res);
        that.setData({
          recommend: res.data.data
        });
        //调用富文本解析器
        that.setWxParse(res.data.data.content);
      }
    });
    //调用富文本编辑器，渲染界面？
   

  },

  setWxParse(article){
    var that = this;
    //国内插件普遍情况，文档说明不足。。。变量名要严格按照文档来，不然根本显示不出来
    WxParse.wxParse('article','html',article,that);
  },
 
  onReady:function(){
    // 页面渲染完成
  },
  onShow:function(){
    // 页面显示
  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  }
})